﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;

namespace iNet.Win32
{
	#region COPYDATASTRUCT
	[StructLayout(LayoutKind.Sequential)]
	public struct COPYDATASTRUCT
	{
		public int dwData;
		public int cbData;
		public IntPtr lpData;
	}
	#endregion
	#region DEV_BROADCAST_DEVICEINTERFACE
	[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
	public struct DEV_BROADCAST_DEVICEINTERFACE
	{
		public int dbcc_size;
		public DBT_DEVTYP dbcc_devicetype;
		public int dbcc_reserved;
		public Guid dbcc_classguid;
		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)]
		public string dbcc_name;
	}
	#endregion
	#region DEV_BROADCAST_HANDLE
	[StructLayout(LayoutKind.Sequential)]
	public struct DEV_BROADCAST_HANDLE
	{
		public int dbch_size;
		public DBT_DEVTYP dbch_devicetype;
		public int dbch_reserved;
		public IntPtr dbch_handle;
		public IntPtr dbch_hdevnotify;
		public Guid dbch_eventguid;
		public int dbch_nameoffset;
		//public byte[] dbch_data;
		public byte dbch_data;
	}
	#endregion
	#region DEV_BROADCAST_HDR
	[StructLayout(LayoutKind.Sequential)]
	public struct DEV_BROADCAST_HDR
	{
		public int dbch_size;
		public DBT_DEVTYP dbch_devicetype;
		public int dbch_reserved;
	}
	#endregion
	#region DEV_BROADCAST_OEM
	[StructLayout(LayoutKind.Sequential)]
	public struct DEV_BROADCAST_OEM
	{
		public int dbco_size;
		public DBT_DEVTYP dbco_devicetype;
		public int dbco_reserved;
		public int dbco_identifier;
		public int dbco_suppfunc;
	}
	#endregion
	#region DEV_BROADCAST_PORT
	[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
	public struct DEV_BROADCAST_PORT
	{
		public int dbcp_size;
		public DBT_DEVTYP dbcp_devicetype;
		public int dbcp_reserved;
		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 255)]
		public string dbcp_name;
	}
	#endregion
	#region DEV_BROADCAST_VOLUME
	[StructLayout(LayoutKind.Sequential)]
	public struct DEV_BROADCAST_VOLUME
	{
		public int dbcv_size;
		public DBT_DEVTYP dbcv_devicetype;
		public int dbcv_reserved;
		public uint dbcv_unitmask;
		public DBTF dbcv_flags;
	}
	#endregion
	#region FLASHWINFO
	[StructLayout(LayoutKind.Sequential)]
	public struct FLASHWINFO
	{
		public int cbSize;
		public IntPtr hwnd;
		public FLASHW dwFlags;
		public uint uCount;
		public uint dwTimeout;
	}
	#endregion
	#region MARGINS
	[StructLayout(LayoutKind.Sequential)]
	public struct MARGINS
	{
		public int cxLeftWidth;
		public int cxRightWidth;
		public int cyTopHeight;
		public int cyBottomHeight;
	}
	#endregion
	#region MINMAXINFO
	[StructLayout(LayoutKind.Sequential)]
	public struct MINMAXINFO
	{
		public POINT ptReserved;
		public POINT ptMaxSize;
		public POINT ptMaxPosition;
		public POINT ptMinTrackSize;
		public POINT ptMaxTrackSize;
	}
	#endregion
	#region MONITORINFO
	[StructLayout(LayoutKind.Sequential)]
	public struct MONITORINFO
	{
		public int cbSize;
		public RECT rcMonitor;
		public RECT rcWork;
		public MONITORINFOF dwFlags;
	}
	#endregion
	#region MONITORINFOEX
	[StructLayout(LayoutKind.Sequential)]
	public struct MONITORINFOEX 
	{
		public int cbSize;
		public RECT rcMonitor;
		public RECT rcWork;
		public MONITORINFOF dwFlags;
		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
		public string szDevice;
	}
	#endregion
	#region POINT
	[StructLayout(LayoutKind.Sequential)]
	public struct POINT
	{
		public int x;
		public int y;
	}
	#endregion
	#region PROPERTYKEY
	[StructLayout(LayoutKind.Sequential)]
	public struct PROPERTYKEY
	{
		public Guid fmtid;
		public uint pid;
	}
	#endregion
	#region PROPVARIANT
	[StructLayout(LayoutKind.Explicit)]
	public struct PROPVARIANT
	{
		[FieldOffset(0)]
		public ushort vt;
		[FieldOffset(2)]
		public short wReserved1;
		[FieldOffset(4)]
		public short wReserved2;
		[FieldOffset(6)]
		public short wReserved3;

		[FieldOffset(8)]
		public byte cVal;
		[FieldOffset(8)]
		public sbyte bVal;
		[FieldOffset(8)]
		public short iVal;
		[FieldOffset(8)]
		public ushort uiVal;
		[FieldOffset(8)]
		public int lVal;
		[FieldOffset(8)]
		public uint ulVal;
		[FieldOffset(8)]
		public int intVal;
		[FieldOffset(8)]
		public uint uintVal;

	}
	#endregion
	#region RECT
	[StructLayout(LayoutKind.Sequential)]
	public struct RECT
	{
		public int left;
		public int top;
		public int right;
		public int bottom;
	}
	#endregion
	#region SHELLEXECUTEINFO
	[StructLayout(LayoutKind.Sequential)]
	public unsafe struct SHELLEXECUTEINFO
	{
		public int cbSize;
		public SEE_MASK fMask;
		public IntPtr hwnd;
		[MarshalAs(UnmanagedType.LPWStr)]
		public string lpVerb;
		[MarshalAs(UnmanagedType.LPWStr)]
		public string lpFile;
		[MarshalAs(UnmanagedType.LPWStr)]
		public string lpParameters;
		[MarshalAs(UnmanagedType.LPWStr)]
		public string lpDirectory;
		public SW nShow;
		public IntPtr hInstApp;
		public IntPtr lpIDList;
		[MarshalAs(UnmanagedType.LPWStr)]
		public string lpClass;
		public IntPtr hkeyClass;
		public uint dwHotKey;
		public IntPtr hIconOrMonitor;
		public IntPtr hProcess;
	}
	#endregion
	#region SHFILEINFO
	[StructLayout(LayoutKind.Sequential)]
	public struct SHFILEINFO
	{
		public IntPtr hIcon;
		public int iIcon;
		public FileAttributes dwAttributes;
		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)MAX.VALUE)]
		public string szDisplayName;
		[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
		public string szTypeName;
	}
	#endregion
	#region SHFILEOPSTRUCT
	[StructLayout(LayoutKind.Sequential)]
	unsafe public struct SHFILEOPSTRUCT
	{
		public IntPtr hwnd;
		public FO wFunc;
		public byte* pFrom;
		public byte* pTo;
		public FOF fFlags;
		public bool fAnyOperationsAborted;
		public void* hNameMappings;
		[MarshalAs(UnmanagedType.LPTStr)]
		public string lpszProgressTitle;
	}
	#endregion
	#region WINDOWPOS
	[StructLayout(LayoutKind.Sequential)]
	public struct WINDOWPOS
	{
		public IntPtr hwnd;
		public IntPtr hwndInsertAfter;
		public int x;
		public int y;
		public int cx;
		public int cy;
		public SWP flags;
	}
	#endregion
}
